<?php
class Category extends AppModel {
	var $name = 'Category';
	var $displayField = 'name';
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $hasMany = array(
		'Item' => array(
			'className' => 'Item',
			'foreignKey' => 'category_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Type' => array(
			'className' => 'Type',
			'foreignKey' => 'category_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
	
	function save_part_two() {
		
	}

	function afterFind($results) {
		foreach ($results as $key => $val) {
			if (isset($val['Category']['created'])) {
				$results[$key]['Category']['created'] = $this->dateFormatAfterFind($val['Category']['created']);
		
			}
	
		}
	
		foreach ($results as $key => $val) {
			if (isset($val['Category']['modified'])) {
				$results[$key]['Category']['modified'] = $this->dateFormatAfterFind($val['Category']['modified']);
		
			}
	
		}
	
		return $results;
	}

	function dateFormatAfterFind($dateString) {
		return date('d-M-Y', strtotime($dateString));
	}
				
}


